package com.shanzmoo.db.module.member.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzmoo.db.module.member.domain.query.MemberAccountPageQuery;
import com.shanzmoo.db.module.member.domain.query.MemberTransPageQuery;
import com.shanzmoo.db.module.member.domain.vo.MemberAccountRecordVO;
import com.shanzmoo.db.module.member.domain.vo.MemberAccountTransVO;
import com.shanzmoo.db.module.member.entity.MemberAccountRecordEntity;
import com.shanzmoo.db.module.member.mapper.MemberAccountRecordMapper;
import com.shanzmoo.db.module.member.service.IMemberAccountRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 会员账户金额变动记录 服务实现类
 * </p>
 *
 * @author wangyudi
 * @since 2021-03-24
 */
@Service
public class MemberAccountRecordServiceImpl extends ServiceImpl<MemberAccountRecordMapper, MemberAccountRecordEntity> implements IMemberAccountRecordService {

    @Override
    public IPage<MemberAccountRecordVO> queryByRequest(MemberAccountPageQuery query) {
        return baseMapper.queryByRequest(query.page(),query);
    }

    @Override
    public List<MemberAccountRecordEntity> getbyMemberMerchantId(Integer id) {
        return list(
                new LambdaQueryWrapper<MemberAccountRecordEntity>().eq(MemberAccountRecordEntity::getMemberMerchantId,id)
        );
    }

    @Override
    public List<MemberAccountRecordEntity> getByMemberIds(List<Integer> collect) {
        return list(
                new LambdaQueryWrapper<MemberAccountRecordEntity>().in(MemberAccountRecordEntity::getMemberMerchantId,collect)
        );
    }

    @Override
    public Page<MemberAccountTransVO> transListByRequest(MemberTransPageQuery request) {
        return baseMapper.queryTransListByRequest(request.page(),request);
    }
}
